<!DOCTYPE html>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
<html><head>

<title>开票信息</title>

<meta content="telephone=no" name="format-detection" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<link type="text/css" rel="stylesheet" href="../../resource/fapiao.css">
<link rel="stylesheet" href="../../resource/weui.min.css"/>
<link rel="stylesheet" href="../../resource/example.css"/>
<!-- 微信引入 -->
<script type="text/javascript" src="../../resource/jweixin-1_002.js"></script>
<script type="text/javascript" src="../../resource/jweixin-1.js"></script>
<script src="../../resource/jquery-1.js"></script>
<script src="../../resource/qrcode.js"></script>
<script src="../../script/api.js"></script>
<link rel="stylesheet" href="../../resource/jinsuistyle.css" />
</head>
<body>
	<div style="background: #27a8fa" id="jsheader">
			<nav id="jsnav">
					<a id="jsleft" tapmode="" onclick="api.closeWin();">
							<span>返回</span>
					</a>
					<div id="jsmiddle">
							<strong id="jstitle">极速开票</strong>
					</div>
					<a id="jsright">
						<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					</a>
			</nav>
	</div>
		<div style="height:40px">&nbsp;</div>
<div id="err_msg" class="weui-toptips weui-toptips_warn js_tooltips">错误提示</div>
<div class="weui-tab">
	<div class="weui-tab__panel">
	<div id="successToast" style="display: none;">
        <div class="weui-mask_transparent"></div>
        <div class="weui-toast">
            <i class="weui-icon-success-no-circle weui-icon_toast"></i>
            <p class="weui-toast__content">保存成功！</p>
        </div>
    </div>
	<div id="loadingToast" style="display:none;">
        <div class="weui-mask_transparent"></div>
        <div class="weui-toast">
            <i class="weui-loading weui-icon_toast"></i>
            <p class="weui-toast__content">请稍后...</p>
        </div>
	</div>
	<div id="DD_Box"></div>
	<div id="null_indicator" style="display:none" class="FP_btn">
		<a style="display:inline-block;display:-moz-inline-stack;width: 90%;color: #888;" href="javascript:;">无开票信息</a>
	</div>
		<div class="page__ft">
<p style="margin-bottom: 6px"><a style="color:#777;font-size:12px">四川航天金穗高技术有限公司</a></p>
</div>
	</div>
	</div>
	<!-- <div class="weui-tabbar" style="box-shadow:0 -2px 2px #aeaeae;">
        <a href="./main.html" class="weui-tabbar__item">
            <img src="../../image/icon_nav_button.png" alt="" class="weui-tabbar__icon">
            <p class="weui-tabbar__label">返回</p>
        </a>
	</div> -->

<script type="text/javascript" src="../..resource/jweixin-1_002.js"></script>
<script type="text/javascript" src="../..resource/jweixin-1.js"></script>
<script type="text/javascript">

var ua = navigator.userAgent.toLowerCase();
var isWeixin = ua.indexOf('micromessenger') != -1;
var isAndroid = ua.indexOf('android') != -1;
var isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1);
var appId = "",timestamp = "",nonceStr="",signature="";
var backToken ='';

function root() {
	var pathName = window.location.pathname.substring(1);
	var webName = pathName == '' ? '' : pathName.substring(0, pathName
			.indexOf('/'));
	return window.location.protocol + '//' + window.location.host + '/'
			+ webName + '/';
}
function getParam(param){
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
	var r = window.location.search.substr(1).match(reg);
	if (r != null)
		return unescape(r[2]);
	return null;
}
function share(data){
	//分享到朋友圈
	wx.onMenuShareTimeline({
		title : data.title,
		link : data.link,
		imgUrl : data.imgUrl,
		trigger : function(res) {

		},
		success : function(res) {

		},
		cancel : function(res) {

		},
		fail : function(res) {

		}
	});
	//分享给朋友
	wx.onMenuShareAppMessage({
	    title: data.title, // 分享标题
	    desc: data.desc, // 分享描述
	    link: data.link, // 分享链接
	    imgUrl: data.imgUrl, // 分享图标
	    type: '', // 分享类型,music、video或link，不填默认为link
	    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
	    success: function () {
	        // 用户确认分享后执行的回调函数
	    },
	    cancel: function () {
	        // 用户取消分享后执行的回调函数
	    }
	});
	//分享到qq
	wx.onMenuShareQQ({
	    title: data.title, // 分享标题
	    desc: data.desc, // 分享描述
	    link: data.link, // 分享链接
	    imgUrl: data.imgUrl, // 分享图标
	    success: function () {
	       // 用户确认分享后执行的回调函数
	    },
	    cancel: function () {
	       // 用户取消分享后执行的回调函数
	    }
	});
	//分享到qq空间
	wx.onMenuShareQZone({
	    title: data.title, // 分享标题
	    desc: data.desc, // 分享描述
	    link: data.link, // 分享链接
	    imgUrl: data.imgUrl, // 分享图标
	    success: function () {
	       // 用户确认分享后执行的回调函数
	    },
	    cancel: function () {
	        // 用户取消分享后执行的回调函数
	    }
	});
	//分享到腾讯微博
	wx.onMenuShareWeibo({
	    title: data.title, // 分享标题
	    desc: data.desc, // 分享描述
	    link: data.link, // 分享链接
	    imgUrl: data.imgUrl, // 分享图标
	    success: function () {
	       // 用户确认分享后执行的回调函数
	    },
	    cancel: function () {
	        // 用户取消分享后执行的回调函数
	    }
	});
}
wx.ready(function() {
	//准备数据
	var wxData = {
		};
	share(wxData);
});
</script>


<script type="text/javascript">
var openid;
var xlist;
var $tooltips = $('.js_tooltips');
$(function(){
	openid=$api.getStorage('openid');
	gridKpInfo();
});

function showErrorMsg(msg){
	$("#err_msg").html(msg);
	if ($tooltips.css('display') != 'none') return;
    $('.page.cell').removeClass('slideIn');
    $tooltips.css('display', 'block');
    setTimeout(function () {
        $tooltips.css('display', 'none');
    }, 5000);
}

function gridKpInfo(){
	$("#loadingToast").fadeIn(100);
	$("#DD_Box").html("");
	apiready = function(){
		var header = $api.byId('jsheader');
		if(api.systemType=='ios'){
			$api.fixIos7Bar(header);
		}
//		else{
//			$api.fixStatusBar(header);
//		}
	api.ajax({
    url: 'http://wechat.scjinsui.com/weixin/wxKpxx/gridKpxxByOpenid.do?openid='+openid,
    method: 'post',
    data: {

    }
}, function(ret, err) {
    if (ret) {
        xlist=ret;
        	if(xlist.length>0){
        		$("#null_indicator").hide();
        	}
        	else{
        		$("#null_indicator").show();
        	}
        	for(var i=0;i<xlist.length;i++){
        		var product=xlist[i].PRODUCE==undefined?"（未录入商品）":xlist[i].PRODUCE;
        		if(xlist[i].FPKJ_STATUE==0){
        			var s="<div style=\"background:#27a8fa\" class=\"FP_box clearfix\"><div class=\"fl\" style=\"width: 100%;\">"+
					"<h6><a style=\"color:#fff \">"+ product +"</a></h6>"+
					"<p style=\"color:#fff;\" id=\"test\">金额（元）：￥"+xlist[i].AMOUNT+"</p>"+
					"<p style=\"padding-bottom: 45px;color:#fff;\" id=\"test\">开票时间："+xlist[i].RKSJ+"</p></div>"+
					"<div class=\"FP_box_hint\">&nbsp;"+xlist[i].FPKJ_MSG+"</div></div>";
					$("#DD_Box").append(s);
        		}
        		if(xlist[i].FPKJ_STATUE==1){
        			var token=""+xlist[i].ID;
        			var s="<div style=\"background:#27a8fa\" class=\"FP_box clearfix\" onclick=\"openKp('"+token+"')\"><div class=\"fl\" style=\"width: 100%;\">"+
					"<h6><a style=\"color:#fff \">"+ product +"</a></h6>"+
					"<p style=\"color:#fff;\" id=\"test\">金额（元）：￥"+xlist[i].AMOUNT+"</p>"+
					"<p style=\"padding-bottom: 45px;color:#fff;\" id=\"test\">订单时间："+xlist[i].RKSJ+"</p></div>"+
					"<div class=\"FP_box_hint\">&nbsp;状态："+xlist[i].FPKJ_MSG+"</div></div>";
					$("#DD_Box").append(s);
        		}

        	}
    } else {
        var a = ret.rst;
        showErrorMsg(a);
        api.alert({msg:'网络异常'});
    }
    setTimeout(function () {
		$("#loadingToast").fadeOut(100);
    }, 500);
});
}
}
function openKp(tokenid){
	$("#loadingToast").fadeIn(100);
	api.ajax({
    url: 'http://wechat.scjinsui.com/weixin/sendKpxx.do?id='+tokenid,
    method: 'post',
    data: {

    }
}, function(ret, err) {
    if (ret) {
    //api.alert(ret.success);
        if(ret.success==true){
        		$("#loadingToast").fadeOut(100);
            	$("#successToast").fadeIn(100);

            	setTimeout(function () {
            		$("#successToast").fadeOut(100);
                }, 1000);
            	gridKpInfo();
        	}
        	else{
        		showErrorMsg(ret.rst);
        	}
    } else {
        showErrorMsg(ret.rst);
        api.alert({msg:'网络异常'});
    }
});

	setTimeout(function () {
		$("#loadingToast").fadeOut(100);
    }, 500);
}


</script>
</body></html>
